package core.lib.model;

import java.util.Hashtable;

public class CoreEvent
{
	private final String mEventType;
	private Hashtable<String, Object> m_parameters;

	public CoreEvent(String eventType)
	{
		if (eventType == null || "".equals(eventType))
		{
			throw new IllegalArgumentException("");
		}
		else
		{
			mEventType = eventType;
		}
	}

	public String getType()
	{
		return mEventType;
	}

	public final void addParameter(String key, Object value)
	{
		if (key == null)
		{
			throw new IllegalArgumentException("The key can not be null!");
		}

		if (value != null)
		{
			// Lazy load
			if (m_parameters == null)
			{
				m_parameters = new Hashtable<String, Object>();
			}

			m_parameters.put(key, value);
		}
	}

	public final Object getParameter(String key)
	{
		if (m_parameters == null)
		{
			return null;
		}
		else
		{
			return m_parameters.get(key);
		}
	}
}
